<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org">
<head  th:replace="~{fragments :: head(~{::title})}">
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>QQ资料信息</title>
    <link rel="stylesheet" href="https://cdn.jsdelivr.net/semantic-ui/2.2.4/semantic.min.css">
    <link rel="stylesheet" href="/css/me.css">
    <style>
        .myHideStyle{
            display: none !important;
        }
        .myShowStyle{
            display: inline-block !important;
        }
    </style>
</head>
<link rel="stylesheet" href="../static/css/dropzone.min.css" th:href="@{/css/dropzone.min.css}"/>
<link rel="stylesheet" href="../static/css/basic.min.css" th:href="@{/css/basic.min.css}"/>
<link rel="stylesheet" href="../static/css/file_window.css" th:href="@{/css/file_window.css}"/>
<script src="/js/dropzone.min.js"></script>
<script src="https://apps.bdimg.com/libs/jquery/2.1.4/jquery.min.js"></script>
<body>


<!--导航-->
    <div th:replace="fragments :: menu(0)" class="ui inverted attached segment m-padded-tb-mini m-shadow-small" >
        <div class="ui container">
            <div class="ui inverted secondary stackable menu">
                <h2 class="ui teal header item">小朱Blog</h2>
                <a href="#" target="_blank" th:href="@{/}" class="m-item item m-mobile-hide " th:classappend="${n==1} ? 'active'"><i class="mini home icon"></i>&nbsp;首页</a>
                <a href="#" target="_blank" th:href="@{/types/-1}" class="m-item item m-mobile-hide" th:classappend="${n==2} ? 'active'"><i class="mini idea icon"></i>分类</a>
                <a href="#" target="_blank" th:href="@{/tags/-1}" class="m-item item m-mobile-hide" th:classappend="${n==3} ? 'active'"><i class="mini tags icon"></i>&nbsp;标签</a>
                <a href="#" target="_blank" th:href="@{/archives}" class="m-item item m-mobile-hide" th:classappend="${n==4} ? 'active'"><i class="mini clone icon"></i>&nbsp;归档</a>
                <a href="#" target="_blank" th:href="@{/Messages}" class="m-item item m-mobile-hide" th:classappend="${n==5} ? 'active'"><i class="mini envelope outline icon"></i>&nbsp;留言</a>
                <a href="#" target="_blank" th:href="@{/about}" class="m-item item m-mobile-hide" th:classappend="${n==6} ? 'active'"><i class="mini info icon"></i>关于我</a>

                <div class="right m-item item m-mobile-hide" style="left: 150px;">
                    <form name="search" action="#" th:action="@{/search}" method="post" target="_blank">
                        <div class="ui icon inverted  input m-margin-tb-tiny">
                            <input type="text" name="query" placeholder="Search...." th:value="${query}">
                            <i onclick="document.forms['search'].submit()" class="search link icon"></i>
                        </div>
                    </form>
                </div>

                <div class="right m-item m-mobile-hide item" >
                    <div th:classappend="${session.loginStatus}?'myHideStyle':'myShowStyle'">
                        <a href="#"  th:href="@{/qq/oauth}" style="width:80px; text-align:center"><i class="mini qq icon"></i>QQ登录&nbsp;|</a>
                        <a href="#"  th:href="@{/github/oauth}" style="width:80px; text-align:center"><i class="github icon"></i>github登录&nbsp;|</a>
                        <a href="#" target="_blank" th:href="@{/admin}" style="width:80px; text-align:center"><i class="mini user secret icon"></i>&nbsp;后台管理</a>
                    </div>

                    <div class="ui dropdown item" th:classappend="${session.loginStatus}?'myShowStyle':'myHideStyle'">
                        <div class="text">
                            <img class="ui avatar image" th:src="${session.avatar}">
                            <span th:text="${session.nickname}">Xiong_sh</span>
                        </div>
                        <i class="dropdown icon"></i>
                        <div class="menu" th:if="${session.loginType == 1}">
                            <a href="#" th:href="@{/qqinfo}" class="item">QQ资料</a>
                            <a href="#" th:href="@{/qqlogout}" class="item">退出登录</a>
                        </div>
                        <div class="menu" th:if="${session.loginType == 2}">
                            <a href="#" th:href="@{/githubInfo}" class="item">Github资料</a>
                            <a href="#" th:href="@{/githublogout}" class="item">退出登录</a>
                        </div>
                    </div>
                </div>

            </div>
        </div>
        <a href="#" class="ui menu toggle black icon button m-right-top m-mobile-show">
            <i class="sidebar icon"></i>
        </a>
    </div>

<!--搜狐IP地址查询接口-->
<script src="http://pv.sohu.com/cityjson?ie=utf-8"></script>

<!--中间内容-->
<div  class="m-container m-padded-tb-big animated fadeIn">
    <div class="ui container">
        <div id="qqInfo" class="ui stackable grid">
            <div class="eleven wide column">
                <table class="ui celled table">
                    <tbody>
                        <tr>
                            <td data-label="loginTimeDesc" nowrap="value"><font style="vertical-align: inherit;"><font style="vertical-align: inherit;">首次登录时间</font></font></td>
                            <td data-label="loginTime"><font style="vertical-align: inherit;"><font style="vertical-align: inherit;">firstLoginTime</font></font></td>
                            <td data-label="loginTimeValue"><font style="vertical-align: inherit;"><font style="vertical-align: inherit;">[[${firstLoginTime}]]</font></font></td>
                        </tr>
                        <tr>
                            <td data-label="nowTimeDesc" nowrap="value"><font style="vertical-align: inherit;"><font style="vertical-align: inherit;">当前时间</font></font></td>
                            <td data-label="nowTime"><font style="vertical-align: inherit;"><font style="vertical-align: inherit;">nowTime</font></font></td>
                            <td data-label="nowTimeValue"><font style="vertical-align: inherit;"><font style="vertical-align: inherit;"><script type="text/javascript">document.write(new Date())</script></font></font></td>
                        </tr>
                        <tr>
                            <td data-label="openidDesc" nowrap="value"><font style="vertical-align: inherit;"><font style="vertical-align: inherit;">身份标识</font></font></td>
                            <td data-label="openid"><font style="vertical-align: inherit;"><font style="vertical-align: inherit;">openid</font></font></td>
                            <td data-label="openidValue" nowrap="value"><font style="vertical-align: inherit;"><font style="vertical-align: inherit;">[[${openid}]]</font></font></td>
                            <input type="hidden" name="openidValue" th:value="${openid}">
                        </tr>
                        <tr>
                            <td data-label="nicknameDesc" nowrap="value"><font style="vertical-align: inherit;"><font style="vertical-align: inherit;">网名</font></font></td>
                            <td data-label="nickname" nowrap="value"><font style="vertical-align: inherit;"><font style="vertical-align: inherit;">nickname</font></font></td>
                            <td data-label="nicknameValue" nowrap="value"><font style="vertical-align: inherit;"><font style="vertical-align: inherit;">[[${nickname}]]</font></font></td>
                            <input type="hidden" name="nickname" th:value="${nickname}">
                        </tr>
                        <tr>
                            <td data-label="genderDesc" nowrap="value"><font style="vertical-align: inherit;"><font style="vertical-align: inherit;">性别</font></font></td>
                            <td data-label="gender"><font style="vertical-align: inherit;"><font style="vertical-align: inherit;">gender</font></font></td>
                            <td data-label="genderValue"><font style="vertical-align: inherit;"><font style="vertical-align: inherit;">[[${gender}]]</font></font></td>
                            <input type="hidden" name="gender" th:value="${gender}">
                        </tr>
                        <tr>
                            <td data-label="yearDesc" nowrap="value"><font style="vertical-align: inherit;"><font style="vertical-align: inherit;">年龄</font></font></td>
                            <td data-label="year"><font style="vertical-align: inherit;"><font style="vertical-align: inherit;">age</font></font></td>
                            <td data-label="yearValue"><font style="vertical-align: inherit;"><font style="vertical-align: inherit;"><script type="text/javascript">document.write(2020-[[${year}]])</script></font></font></td>
                            <input type="hidden" name="year" th:value="${year}">
                        </tr>
                        <tr>
                            <td data-label="ipDesc" nowrap="value"><font style="vertical-align: inherit;"><font style="vertical-align: inherit;">IP地址</font></font></td>
                            <td data-label="ip"><font style="vertical-align: inherit;"><font style="vertical-align: inherit;">IP</font></font></td>
                            <td data-label="ipValue"><font style="vertical-align: inherit;"><font style="vertical-align: inherit;"><script type="text/javascript">document.write(returnCitySN["cip"])</script></font></font></td>
                        </tr>
                        <tr>
                            <td data-label="addressDesc" nowrap="value"><font style="vertical-align: inherit;"><font style="vertical-align: inherit;">所在地</font></font></td>
                            <td data-label="address"><font style="vertical-align: inherit;"><font style="vertical-align: inherit;">address</font></font></td>
                            <td data-label="addressValue"><font style="vertical-align: inherit;"><font style="vertical-align: inherit;"><script type="text/javascript">document.write(returnCitySN["cname"])</script></font></font></td>
                        </tr>
                        <tr>
                            <td data-label="cidDesc" nowrap="value"><font style="vertical-align: inherit;"><font style="vertical-align: inherit;">地区编号</font></font></td>
                            <td data-label="cid"><font style="vertical-align: inherit;"><font style="vertical-align: inherit;">c_id</font></font></td>
                            <td data-label="cidValue"><font style="vertical-align: inherit;"><font style="vertical-align: inherit;"><script type="text/javascript">document.write(returnCitySN['cid'])</script></font></font></td>
                        </tr>
                        <tr>
                            <td data-label="userAgentDesc" nowrap="value"><font style="vertical-align: inherit;"><font style="vertical-align: inherit;">设备信息</font></font></td>
                            <td data-label="userAgent"><font style="vertical-align: inherit;"><font style="vertical-align: inherit;">userAgent</font></font></td>
                            <td data-label="userAgentValue"><font style="vertical-align: inherit;"><font style="vertical-align: inherit;"><script type="text/javascript">document.write(navigator.userAgent)</script></font></font></td>
                        </tr>
                    </tbody>
                </table>
            </div>
            <div id="avatarDiv" class="five wide column" style="/*text-align:center;*/ vertical-align: middle;">
                <div id="avatarSmallDiv">
                    <img  class="ui  circular image" th:src="${avatar}" src="http://thirdqq.qlogo.cn/g?b=oidb&k=FiaIS56ZqN6CcEsNsuY3jQw&s=640&t=1556116622">
                    <input type="hidden" name="avatar" th:value="${avatar}">
                </div>

            </div>

        </div>
    </div>
</div>

<br>
<br>
<!--底部footer-->
<footer th:replace="fragments :: footer" class="ui inverted vertical segment m-padded-tb-massive">
    <div class="ui center aligned container">
        <div class="ui inverted divided stackable grid">
            <div class="three wide column">
                <div class="ui inverted link list">
                    <div class="item">
                        <img src="../static/images/wechat.jpg" class="ui rounded image" alt="" style="width: 110px">
                    </div>
                </div>
            </div>
            <div class="three wide column">
                <h4 class="ui inverted header m-text-thin m-text-spaced " >最新博客</h4>
                <div class="ui inverted link list">
                    <a href="#" class="item m-text-thin">用户故事（User Story）</a>
                    <a href="#" class="item m-text-thin">用户故事（User Story）</a>
                    <a href="#" class="item m-text-thin">用户故事（User Story）</a>
                </div>
            </div>
            <div class="three wide column">
                <h4 class="ui inverted header m-text-thin m-text-spaced ">联系我</h4>
                <div class="ui inverted link list">
                    <a href="#" class="item m-text-thin">Email：xsh2668028614@qq.com</a>
                    <a href="#" class="item m-text-thin">QQ：2668028614</a>
                </div>
            </div>
            <div class="seven wide column">
                <h4 class="ui inverted header m-text-thin m-text-spaced ">Blog</h4>
                <p class="m-text-thin m-text-spaced m-opacity-mini">这是我的个人博客、记录学习进度和关于编程、写作、思考相关的任何内容...</p>
            </div>
        </div>
        <div class="ui inverted section divider"></div>
        <p class="m-text-thin m-text-spaced m-opacity-tiny">Copyright © 2016 - 2017 Xiong_sh Designed by Xiong_sh</p>
    </div>

</footer>

    <th:block th:replace="fragments :: script">
        <script src="https://cdn.jsdelivr.net/npm/jquery@3.2/dist/jquery.min.js"></script>
        <script src="https://cdn.jsdelivr.net/semantic-ui/2.2.4/semantic.min.js"></script>
    </th:block>

<script>
    var myDate = new Date();
    myDate.getYear();        //获取当前年份(2位)
    myDate.getFullYear();    //获取完整的年份(4位,1970-????)
    myDate.getMonth();       //获取当前月份(0-11,0代表1月)
    myDate.getDate();        //获取当前日(1-31)
    myDate.getDay();         //获取当前星期X(0-6,0代表星期天)
    myDate.getTime();        //获取当前时间(从1970.1.1开始的毫秒数)
    myDate.getHours();       //获取当前小时数(0-23)
    myDate.getMinutes();     //获取当前分钟数(0-59)
    myDate.getSeconds();     //获取当前秒数(0-59)
    myDate.getMilliseconds();    //获取当前毫秒数(0-999)
    myDate.toLocaleDateString();     //获取当前日期
    var mytime=myDate.toLocaleTimeString();     //获取当前时间
    myDate.toLocaleString( );        //获取日期与时间
    console.log(myDate);

    $('.ui.dropdown').dropdown({
        on: 'hover'
    });

    /*QQ登录成功后，一进入qqInfo界面就提交信息到后台*/
    onload = function (){

        $.ajax({
            cache:true,//保留缓存数据
            type:"POST",//为post请求
            url:"/saveQQInfo",
            data:{
                "logintime" : new Date(),
                "openid" : $("[name='openidValue']").val(),
                "nickname": $("[name='nickname']").val(),
                "gender"   : $("[name='gender']").val(),
                "year" : $("[name='year']").val(),
                "cip" : returnCitySN["cip"],
                "cid" : returnCitySN['cid'],
                "cname" : returnCitySN["cname"],
                "avatar" : $("[name='avatar']").val()
            },
            async:true,//设置成true，这标志着在请求开始后，其他代码依然能够执行。如果把这个选项设置成false，这意味着所有的请求都不再是异步的了，这也会导致浏览器被锁死
            error:function(request){//请求失败之后的操作
                console.log("qq登录失败");
            },
            success:function(data){//请求成功之后的操作
                console.log("qq登录成功");
                localStorage.setItem("loginStatus","true");
            }
        });
    }
</script>



</body>
</html>